package org.example.test.test;

import java.util.Arrays;
import java.util.jar.JarEntry;

/**
 * 删除有序数组中的重复项
 */
public class RemoveDuplicates {
    public static void main(String[] args) {

    }

    public int removeDuplicates(int[] nums) {
        int slow = 0;
        for (int i = 1; i < nums.length; i++) {
            if (nums[i] != nums[slow]) {
                slow++;
                nums[slow] = nums[i];
            }
        }
        return slow + 1;
    }
}
